﻿


$.BigLoadingPopup = function (popupdiv) {
    var overlayElement = $('#overlay');
    if (overlayElement.length == 0) {
        overlayElement = $("<div id='overlay'></div>");
        overlayElement.css({
            "position": "fixed",
            "background-color": "#000000",
            "opacity": 0.8,
            "top": 0,
            "left": 0,
            "width": $(document).width(),
            "height": $(document).height(),
            "z-index": 9998
        });
        overlayElement.appendTo("body");
    }

    $(popupdiv).css({
        "position": "fixed",
        //"top": (screen.height - $(popupdiv).outerHeight()) / 2,
        "top": 0,
        "left": (parseFloat($('body').innerWidth()) - $(popupdiv).innerWidth()) / 2,
        "z-index": 9999
    });
	

    overlayElement.show();
    $(popupdiv).fadeIn();
/*    $(popupdiv).draggable();
*/    $(popupdiv).css("position", "fixed");

    var closeButton = $(popupdiv).find('.zoombox_close');
    if (closeButton.length > 0) {
        closeButton.bind("click", function () {
            hidePopup(popupdiv);
        });
    }

    $("#overlay").bind("click", function () {
        hidePopup(popupdiv);
    });

};

function showPopup(popupid) {
    $.BigLoadingPopup(popupid);
    $("#overlay").click(function(){
		hidePopup(popupid);
		});


    return false;
}

function hidePopup(popupid) {
    $("#overlay").remove();
    $(popupid).hide();
}
